﻿//-----------------------------------------------------------------------
// <copyright file="GlobalCommandsView.xaml.cs" author="Artak Mkrtchyan">
//     Creative Commons - GNU General Public License (http://creativecommons.org/licenses/GPL/2.0/
// </copyright>
// <author>Artak Mkrtchyan</author>
// <email>mkArtak@gmail.com</email>
// <date>02/09/2012</date>
//-----------------------------------------------------------------------

using ConsoleHoster.Common.Utilities;
using ConsoleHoster.Common.Utilities.Threading;
using ConsoleHoster.Model.Entities;
using ConsoleHoster.ViewModel;
using System.Collections.Generic;
using System.Windows;

namespace ConsoleHoster.View.Popups
{
	/// <summary>
	/// Interaction logic for GlobalCommandsView.xaml
	/// </summary>
	public partial class GlobalCommandsView : Window
	{
		private readonly GlobalCommandsViewModel viewModel;

		public GlobalCommandsView(IEnumerable<CommandData> argCommands, IDispatcher argDispatcher, ILogger argLogger)
		{
			InitializeComponent();

			this.viewModel = new GlobalCommandsViewModel(argDispatcher, argCommands, argLogger);
			this.DataContext = this.viewModel;
		}

		private void btnSave_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = true;
		}

		private void btnCancel_Click(object sender, RoutedEventArgs e)
		{
			this.DialogResult = false;
		}

		public GlobalCommandsViewModel ViewModel
		{
			get
			{
				return this.viewModel;
			}
		}
	}
}
